home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 10590 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.0 KB

  1. Path: druid.borland.com!usenet
  2. From: pete@borland.com (Pete Becker)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: RTTI and MSVC 4.0 examples sought
  5. Date: 8 Mar 1996 18:41:31 GMT
  6. Organization: Borland International
  7. Message-ID: <4hpv0r$7sv@druid.borland.com>
  8. References: <313F912F.39D2@vream.com>
  9. NNTP-Posting-Host: pbecker.borland.com
  10. Mime-Version: 1.0
  11. Content-Type: Text/Plain; charset=ISO-8859-1
  12. X-Newsreader: WinVN 0.99.5
  13.  
  14. In article <313F912F.39D2@vream.com>, tnewark@vream.com says...
  15. >
  16. >I'm looking for some examples of using RTTI with MSVC 4.0.
  17. >
  18. >The problem I'm specifically trying to solve is that I want to implement
  19. >IsKindOf(Ptr, class) where I return true if a ptr is type class or a 
  20. >subclass of class, and false otherwise.
  21. >
  22. >MicroSoft's documentation is very weak on the RTTI subject and type_info 
  23. >class, especially about such things as collating order (what exactly is 
  24. >it?)
  25.  
  26. #define IsKindOf(Ptr,class) dynamic_cast<class *>(Ptr)
  27. }
  28.  
  29. I haven't tried this with MSVC 4.0. However, it should work on any compiler 
  30. that implements RTTI correctly.
  31.  
  32.